var areaName = localStorage.getItem("areaName");
function getWeather(areaname){
    $.ajax({
		url: "https://free-api.heweather.com/s6/weather/now?location=" + areaname +",重庆&key=7383fbf900954b2aa64ba41d820f9cb0",
		type: "GET",
		dataType: "json", 
		success: function(data1) {
			console.log(data1.HeWeather6[0].basic.location)
            //console.log();           
            var weather = data1.HeWeather6[0].now,
                updatetime = data1.HeWeather6[0].update.loc.substring(11);
            $("#temp").text(weather.tmp+"℃");
            $("#weather_code").attr("src","images/weather/"+weatherLogo(weather.cond_txt)+".png");
            $("#updatetime").text(updatetime+" 更新");
			$("#wind_num").text(weather.wind_dir+": "+weather.wind_sc+"级");	
			$("#humidity_num").text("相对湿度: "+weather.hum+"%");
			weatherLogo(weather.cond_txt);
		}
	});
}
function getAir(areaname){
	$.ajax({
		url: "https://free-api.heweather.com/s6/air/now?location=" + areaname +",重庆&key=7383fbf900954b2aa64ba41d820f9cb0",
		type: "GET",
		dataType: "json", 
		success: function(data2) {
			var air = data2.HeWeather6[0].air_now_city;
			$("#air_quality").text("空气质量: "+air.aqi+air.qlty);
		}
	});
}
getAir(areaName);
getWeather(areaName);